package com.ypf.survey.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.ypf.survey.dao.QuestionDAO;
import com.ypf.survey.model.Question;

@Repository
public class QuestionDAOImpl extends GenericDAOImpl<Question, Integer> implements QuestionDAO {

	protected QuestionDAOImpl() {
		super(Question.class.getName());
	}

	@SuppressWarnings("unchecked")
	public List<Question> getQuestions() {
	
		DetachedCriteria criteria = DetachedCriteria.forEntityName(entityName);
		criteria.add(Restrictions.eq("active", true));
		return getHibernateTemplate().findByCriteria(criteria);
	}
}
